<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$lur=is_login();
//add by gary 2016/10/23 验证下当前届数
$year = ReturnPublicAddVar('year'); //后台最后更新的年份
$nowYear = date('Y',time());
if($nowYear != $year){
    //$checkTime =  mktime(0, 0, 0, 6, 1, $year+1); //每年的6月1号
    $endTime = mktime(0, 0, 0, 6, 1, date('Y',time())); //今年的6月1号
    //只要过了6月1号，就更新一次
    if(time() - $endTime >= 0){
        //所有校区的年级
        $grades = array(24,);
        foreach ($grades as $key => $value) {
            $empire->query("update {$dbtbpre}enewsclass set classname=replace(classname,'一年级','二年级'),bclassname=replace(classname,'一年级','二年级') where bclassid = ".$value." and classname like '%一年级%'");
            $empire->query("update {$dbtbpre}enewsclass set classname=replace(classname,'二年级','三年级'),bclassname=replace(classname,'二年级','三年级') where bclassid = ".$value." and classname like '%二年级%'");
            $empire->query("update {$dbtbpre}enewsclass set classname=replace(classname,'三年级','四年级'),bclassname=replace(classname,'三年级','四年级') where bclassid = ".$value." and classname like '%三年级%'");
            $empire->query("update {$dbtbpre}enewsclass set classname=replace(classname,'四年级','五年级'),bclassname=replace(classname,'四年级','五年级') where bclassid = ".$value." and classname like '%四年级%'");
            $empire->query("update {$dbtbpre}enewsclass set classname=replace(classname,'五年级','六年级'),bclassname=replace(classname,'五年级','六年级') where bclassid = ".$value." and classname like '%五年级%'");
            //六年级毕业
            $oldname = (date('Y',time())-6) .'届';
            $empire->query("update {$dbtbpre}enewsclass set classname='$oldname',bclassname='$oldname' where bclassid = ".$value." and classname like '%六年级%'");

            //新增一年级一班-六班

        }
    }
}



$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=(int)$lur['groupid'];
$loginadminstyleid=(int)$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
@include("adminstyle/".$loginadminstyleid."/AdminMain.php");
db_close();
$empire=null;
?>